package com.wuxiaofan.product.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.product.entity.SpuImages;
import com.wuxiaofan.product.entity.custom.SpuImagesCustom;
import com.wuxiaofan.product.mapper.SpuImagesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.product.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SpuImagesService {
    @Autowired
    private SpuImagesMapper pmsSpuImagesMapper;
    @Resource
    private Idgenerator idgenerator;
    public SpuImages findById(String id){
        return pmsSpuImagesMapper.selectById(id);
    }

    public SpuImagesCustom findCountByMap(Map paraMap){
        return pmsSpuImagesMapper.findCountByMap(paraMap);
    }

    public SpuImagesCustom findGroupByMap(Map paraMap){
        return pmsSpuImagesMapper.findGroupByMap(paraMap);
    }

    public List<SpuImagesCustom> findByMap(Map paraMap){
        return pmsSpuImagesMapper.findByMap(paraMap);
    }

    public Page<SpuImagesCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(pmsSpuImagesMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        pmsSpuImagesMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        pmsSpuImagesMapper.deleteById(id);
    }

    public SpuImages save(SpuImages pmsSpuImages){
        pmsSpuImages.setId(idgenerator.getId());
        pmsSpuImagesMapper.insert(pmsSpuImages);
        return pmsSpuImages;
    }

}
